﻿package chapter_04_Homework;

public class Work_09_Cat extends Work_09_Pet{
	private String color;
	public Work_09_Cat(String name,String color) {
		super(name);
		this.color=color;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}
	/**
	 * 实现吃饭方法
	 */
	@Override
	public void eat() {
		if(getHealth()>=100){
			System.out.println("狗狗"+this.getName()+"吃饱啦");
		}
		else{
			this.setHealth(this.getHealth()+4);
			System.out.println("猫咪"+this.getName()+"吃饱啦，体力+4");
		}
	}
}
